// 初始化
function applyForm() {
    $(".form-msqdel").jQValidator({
        isClearForm: false,
        excluded: ':disabled',
        fields: {
            gender: {
                validators: {
                    notEmpty: true,
                    gender: {
                        idCardName: 'idNumber'
                    }
                }
            },
            check2list: {
                validators: {
                    notEmpty: {
                        message: '此项为必填项'
                    }
                }
            },
            check3list: {
                validators: {
                    notEmpty: {
                        message: '此项为必填项'
                    }
                }
            },
            check4list: {
                validators: {
                    notEmpty: {
                        message: '此项为必填项'
                    }
                }
            },
            check5list: {
                validators: {
                    notEmpty: {
                        message: '此项为必填项'
                    }
                }
            },
            check6list: {
                validators: {
                    notEmpty: {
                        message: '此项为必填项'
                    }
                }
            },
            check7list: {
                validators: {
                    notEmpty: {
                        message: '此项为必填项'
                    }
                }
            },
            check8list: {
                validators: {
                    notEmpty: {
                        message: '此项为必填项'
                    }
                }
            },
            check9list: {
                validators: {
                    notEmpty: {
                        message: '此项为必填项'
                    }
                }
            },
            check10list: {
                validators: {
                    notEmpty: {
                        message: '此项为必填项'
                    }
                }
            },
            check11list: {
                validators: {
                    notEmpty: {
                        message: '此项为必填项'
                    }
                }
            },
            check12list: {
                validators: {
                    notEmpty: {
                        message: '此项为必填项'
                    }
                }
            },
        }
    });
}

$('.btn-hrapply').on(tap, function() {
    $('#modalHrbox').modal('show');
});
$(window).on("load", function() {
    applyForm();
});

// 表单关闭
$('.hr-pop .close').on('click', function() {
    $('.hr-pop').hide()

})

// 表单提交
$('.form-msqdel .btn-submit').on('click', function() {
    /// 点击提交按钮进行校验
    var isValid;
    var jQValidator = $(".form-msqdel").data('jQValidator');
    jQValidator.validate();

    /// bool, 所有字段验证是否正确
    var isValid = $('.form-msqdel').data('jQValidator').isValid();
    // console.log(1)

    if (isValid) {
        // 提交成功弹窗
        $('.p-msqdel #modalTipsSuc').show()
        $('.p-msqdel #modalTipsSuc').css('opacity', '1')

    } else {
        // 提交错误弹窗
        $('.p-msqdel #modalTipsError').show()
        $('.p-msqdel #modalTipsSuc').css('opacity', '1')
    }

});

$('.form-msqdel .btn-reset').on(tap, function() {
    location.reload(true)
        // $(".form-msqdel").data('jQValidator').resetForm(true);
        // applyForm();
        // alert(1)
})

// 表单关闭
$('.p-msqdel .btn-sure').on('click', function() {
    $(this).parents('.modal-tips').hide()
    $(this).parents('.modal-tips').css('opacity', '0')
})